<?php
class Rates {
	
	/**
     * @var object Zend DB Adapter
     */
    private $_db;
    /**
     * @var string
     */
   
    public function __construct()
    {
			$this->_db = Zend_Registry::get('db');
    }
    
    public function addRates($form_values)
    {
    	$type = $form_values['type'];
    	$customer = $form_values['customer'];
    	$location = $form_values['location'];
    	$distance = $form_values['distance'];
    	$rate = $form_values['rate'];
    	
    	$addRate = $this->_db->exec("
    		INSERT INTO transport_rates(type, cust_id, location, distance, rate)
    		VALUES('" . $type . "', '" . $customer . "', '" . $location . "', '" . $distance . "', '" . $rate . "')
    	");
    	
    	if($addRate) {
    		echo "Rate has been successfully added.";
    	}
    	
    }
}
?>